$(function () {
    // 获取消息列表
    var loading = weui.loading('loading', {
        className: 'custom-classname'
    });
    var result = Model.message.messageList();
    if (!sessionStorage.getItem('hmdj_stopError')) {
        sessionStorage.setItem('hmdj_stopError', true);
    } else {
        if (result.code) {
            Common.fn.formatOutput(result);
            loading.hide();
            return false;
        }
    }
    for (var i = 0; i < result.data.length; i++) {
        var item = '<div class="weui-panel weui-panel_access"><a href="chat.html?cid=' + result.data[i].openid + '" class="weui-media-box weui-media-box_appmsg"><div class="weui-media-box__hd"><div class="shop-vendor-left"><div class="portrait-block"><img class="portrait-img" src="' + result.data[i].photo + '"></div></div></div><div class="weui-media-box__bd"><div class="weui-cell"><div class="weui-cell__bd"><h2>' + result.data[i].nickname + '</h2></div><div class="weui-cell__ft"><h2>' + result.data[i].time + '</h2></div></div><p class="weui-media-box__desc"><h2 class="weui-media-box__title">' + result.data[i].content + '</h2></p></div></a></div>';
        $('.message').append(item);
    }
    loading.hide();
});